home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / CMApplication.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  39.5 KB  |  1,202 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CMApplication.h
  3.  
  4.      Contains:    ColorSync API
  5.  
  6.      Version:    Technology:    ColorSync 2.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1992-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __CMAPPLICATION__
  18. #define __CMAPPLICATION__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __QUICKDRAW__
  24. #include <Quickdraw.h>
  25. #endif
  26. #ifndef __FILES__
  27. #include <Files.h>
  28. #endif
  29. #ifndef __PRINTING__
  30. #include <Printing.h>
  31. #endif
  32. #ifndef __CMICCPROFILE__
  33. #include <CMICCProfile.h>
  34. #endif
  35. #ifndef __DISPLAYS__
  36. #include <Displays.h>
  37. #endif
  38.  
  39.  
  40.  
  41. #if PRAGMA_ONCE
  42. #pragma once
  43. #endif
  44.  
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48.  
  49. #if PRAGMA_IMPORT
  50. #pragma import on
  51. #endif
  52.  
  53. #if PRAGMA_STRUCT_ALIGN
  54.     #pragma options align=mac68k
  55. #elif PRAGMA_STRUCT_PACKPUSH
  56.     #pragma pack(push, 2)
  57. #elif PRAGMA_STRUCT_PACK
  58.     #pragma pack(2)
  59. #endif
  60.  
  61.  
  62. enum {
  63.     kDefaultCMMSignature        = FOUR_CHAR_CODE('appl')
  64. };
  65.  
  66. /* Macintosh 68K trap word */
  67.  
  68. enum {
  69.     cmTrap                        = 0xABEE
  70. };
  71.  
  72.  
  73. /* PicComment IDs */
  74.  
  75. enum {
  76.     cmBeginProfile                = 220,
  77.     cmEndProfile                = 221,
  78.     cmEnableMatching            = 222,
  79.     cmDisableMatching            = 223,
  80.     cmComment                    = 224
  81. };
  82.  
  83. /* PicComment selectors for cmComment */
  84.  
  85. enum {
  86.     cmBeginProfileSel            = 0,
  87.     cmContinueProfileSel        = 1,
  88.     cmEndProfileSel                = 2,
  89.     cmProfileIdentifierSel        = 3
  90. };
  91.  
  92.  
  93. /* Defines for version 1.0 CMProfileSearchRecord.fieldMask */
  94.  
  95. enum {
  96.     cmMatchCMMType                = 0x00000001,
  97.     cmMatchApplProfileVersion    = 0x00000002,
  98.     cmMatchDataType                = 0x00000004,
  99.     cmMatchDeviceType            = 0x00000008,
  100.     cmMatchDeviceManufacturer    = 0x00000010,
  101.     cmMatchDeviceModel            = 0x00000020,
  102.     cmMatchDeviceAttributes        = 0x00000040,
  103.     cmMatchFlags                = 0x00000080,
  104.     cmMatchOptions                = 0x00000100,
  105.     cmMatchWhite                = 0x00000200,
  106.     cmMatchBlack                = 0x00000400
  107. };
  108.  
  109. /* Defines for version 2.0 CMSearchRecord.searchMask */
  110.  
  111. enum {
  112.     cmMatchAnyProfile            = 0x00000000,
  113.     cmMatchProfileCMMType        = 0x00000001,
  114.     cmMatchProfileClass            = 0x00000002,
  115.     cmMatchDataColorSpace        = 0x00000004,
  116.     cmMatchProfileConnectionSpace = 0x00000008,
  117.     cmMatchManufacturer            = 0x00000010,
  118.     cmMatchModel                = 0x00000020,
  119.     cmMatchAttributes            = 0x00000040,
  120.     cmMatchProfileFlags            = 0x00000080
  121. };
  122.  
  123. /* Result codes */
  124.  
  125. enum {
  126.                                                                 /* General Errors */
  127.     cmProfileError                = -170,
  128.     cmMethodError                = -171,
  129.     cmMethodNotFound            = -175,                            /* CMM not present */
  130.     cmProfileNotFound            = -176,                            /* Responder error */
  131.     cmProfilesIdentical            = -177,                            /* Profiles the same */
  132.     cmCantConcatenateError        = -178,                            /* Profile can't be concatenated */
  133.     cmCantXYZ                    = -179,                            /* CMM cant handle XYZ space */
  134.     cmCantDeleteProfile            = -180,                            /* Responder error */
  135.     cmUnsupportedDataType        = -181,                            /* Responder error */
  136.     cmNoCurrentProfile            = -182,                            /* Responder error */
  137.                                                                 /* Profile Access Errors */
  138.     cmElementTagNotFound        = -4200,
  139.     cmIndexRangeErr                = -4201,                        /* Tag index out of range */
  140.     cmCantDeleteElement            = -4202,
  141.     cmFatalProfileErr            = -4203,
  142.     cmInvalidProfile            = -4204,                        /* A Profile must contain a 'cs1 ' tag to be valid */
  143.     cmInvalidProfileLocation    = -4205,                        /* Operation not supported for this profile location */
  144.     cmCantCopyModifiedV1Profile    = -4215,                        /* Illegal to copy version 1 profiles that have been modified */
  145.                                                                 /* Profile Search Errors */
  146.     cmInvalidSearch                = -4206,                        /* Bad Search Handle */
  147.     cmSearchError                = -4207,
  148.     cmErrIncompatibleProfile    = -4208,                        /* Other ColorSync Errors */
  149.     cmInvalidColorSpace            = -4209,                        /* Profile colorspace does not match bitmap type */
  150.     cmInvalidSrcMap                = -4210,                        /* Source pix/bit map was invalid */
  151.     cmInvalidDstMap                = -4211,                        /* Destination pix/bit map was invalid */
  152.     cmNoGDevicesError            = -4212,                        /* Begin/End Matching -- no gdevices available */
  153.     cmInvalidProfileComment        = -4213,                        /* Bad Profile comment during drawpicture */
  154.     cmRangeOverFlow                = -4214,                        /* Color conversion warning that some output color values over/underflowed and were clipped */
  155.     cmNamedColorNotFound        = -4216,                        /* NamedColor not found */
  156.     cmCantGamutCheckError        = -4217                            /* Gammut checking not supported by this ColorWorld */
  157. };
  158.  
  159. /* deviceType values for ColorSync 1.0 Device Profile access */
  160.  
  161. enum {
  162.     cmSystemDevice                = FOUR_CHAR_CODE('sys '),
  163.     cmGDevice                    = FOUR_CHAR_CODE('gdev')
  164. };
  165.  
  166. /* Commands for CMFlattenUPP(…) */
  167.  
  168. enum {
  169.     cmOpenReadSpool                = 1,
  170.     cmOpenWriteSpool            = 2,
  171.     cmReadSpool                    = 3,
  172.     cmWriteSpool                = 4,
  173.     cmCloseSpool                = 5
  174. };
  175.  
  176. /* Flags for PostScript-related functions */
  177.  
  178. enum {
  179.     cmPS7bit                    = 1,
  180.     cmPS8bit                    = 2
  181. };
  182.  
  183. /* Flags for profile embedding functions */
  184.  
  185. enum {
  186.     cmEmbedWholeProfile            = 0x00000000,
  187.     cmEmbedProfileIdentifier    = 0x00000001
  188. };
  189.  
  190. /* Commands for CMAccessUPP(…) */
  191.  
  192. enum {
  193.     cmOpenReadAccess            = 1,
  194.     cmOpenWriteAccess            = 2,
  195.     cmReadAccess                = 3,
  196.     cmWriteAccess                = 4,
  197.     cmCloseAccess                = 5,
  198.     cmCreateNewAccess            = 6,
  199.     cmAbortWriteAccess            = 7,
  200.     cmBeginAccess                = 8,
  201.     cmEndAccess                    = 9
  202. };
  203.  
  204.  
  205. /* Abstract data type for memory-based Profile */
  206. typedef struct OpaqueCMProfileRef*         CMProfileRef;
  207. /* Abstract data type for Profile search result */
  208. typedef struct OpaqueCMProfileSearchRef*  CMProfileSearchRef;
  209. /* Abstract data type for BeginMatching(…) reference */
  210. typedef struct OpaqueCMMatchRef*         CMMatchRef;
  211. /* Abstract data type for ColorWorld reference */
  212. typedef struct OpaqueCMWorldRef*         CMWorldRef;
  213. /* Caller-supplied flatten function */
  214. typedef CALLBACK_API( OSErr , CMFlattenProcPtr )(long command, long *size, void *data, void *refCon);
  215. /* Caller-supplied progress function for Bitmap & PixMap matching routines */
  216. typedef CALLBACK_API( Boolean , CMBitmapCallBackProcPtr )(long progress, void *refCon);
  217. /* Caller-supplied filter function for Profile search */
  218. typedef CALLBACK_API( Boolean , CMProfileFilterProcPtr )(CMProfileRef prof, void *refCon);
  219. /* Caller-supplied function for profile access */
  220. typedef CALLBACK_API( OSErr , CMProfileAccessProcPtr )(long command, long offset, long *size, void *data, void *refCon);
  221. typedef STACK_UPP_TYPE(CMFlattenProcPtr)                         CMFlattenUPP;
  222. typedef STACK_UPP_TYPE(CMBitmapCallBackProcPtr)                 CMBitmapCallBackUPP;
  223. typedef STACK_UPP_TYPE(CMProfileFilterProcPtr)                     CMProfileFilterUPP;
  224. typedef STACK_UPP_TYPE(CMProfileAccessProcPtr)                     CMProfileAccessUPP;
  225. enum { uppCMFlattenProcInfo = 0x00003FE0 };                     /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  226. enum { uppCMBitmapCallBackProcInfo = 0x000003D0 };                 /* pascal 1_byte Func(4_bytes, 4_bytes) */
  227. enum { uppCMProfileFilterProcInfo = 0x000003D0 };                 /* pascal 1_byte Func(4_bytes, 4_bytes) */
  228. enum { uppCMProfileAccessProcInfo = 0x0000FFE0 };                 /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  229. #define NewCMFlattenProc(userRoutine)                             (CMFlattenUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMFlattenProcInfo, GetCurrentArchitecture())
  230. #define NewCMBitmapCallBackProc(userRoutine)                     (CMBitmapCallBackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMBitmapCallBackProcInfo, GetCurrentArchitecture())
  231. #define NewCMProfileFilterProc(userRoutine)                     (CMProfileFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMProfileFilterProcInfo, GetCurrentArchitecture())
  232. #define NewCMProfileAccessProc(userRoutine)                     (CMProfileAccessUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMProfileAccessProcInfo, GetCurrentArchitecture())
  233. #define CallCMFlattenProc(userRoutine, command, size, data, refCon)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppCMFlattenProcInfo, (command), (size), (data), (refCon))
  234. #define CallCMBitmapCallBackProc(userRoutine, progress, refCon)  CALL_TWO_PARAMETER_UPP((userRoutine), uppCMBitmapCallBackProcInfo, (progress), (refCon))
  235. #define CallCMProfileFilterProc(userRoutine, prof, refCon)         CALL_TWO_PARAMETER_UPP((userRoutine), uppCMProfileFilterProcInfo, (prof), (refCon))
  236. #define CallCMProfileAccessProc(userRoutine, command, offset, size, data, refCon)  CALL_FIVE_PARAMETER_UPP((userRoutine), uppCMProfileAccessProcInfo, (command), (offset), (size), (data), (refCon))
  237. typedef long                             CMError;
  238. /* For 1.0 and 2.0 profile header variants */
  239. /* CMAppleProfileHeader */
  240.  
  241. union CMAppleProfileHeader {
  242.     CMHeader                         cm1;
  243.     CM2Header                         cm2;
  244. };
  245. typedef union CMAppleProfileHeader        CMAppleProfileHeader;
  246. /* Param for CWConcatColorWorld(…) */
  247.  
  248. struct CMConcatProfileSet {
  249.     unsigned short                     keyIndex;                    /* Zero-based */
  250.     unsigned short                     count;                        /* Min 1 */
  251.     CMProfileRef                     profileSet[1];                /* Variable. Ordered from Source -> Dest */
  252. };
  253. typedef struct CMConcatProfileSet        CMConcatProfileSet;
  254. /* ColorSync color data types */
  255.  
  256. struct CMRGBColor {
  257.     unsigned short                     red;                        /* 0..65535 */
  258.     unsigned short                     green;
  259.     unsigned short                     blue;
  260. };
  261. typedef struct CMRGBColor                CMRGBColor;
  262.  
  263. struct CMCMYKColor {
  264.     unsigned short                     cyan;                        /* 0..65535 */
  265.     unsigned short                     magenta;
  266.     unsigned short                     yellow;
  267.     unsigned short                     black;
  268. };
  269. typedef struct CMCMYKColor                CMCMYKColor;
  270.  
  271. struct CMCMYColor {
  272.     unsigned short                     cyan;                        /* 0..65535 */
  273.     unsigned short                     magenta;
  274.     unsigned short                     yellow;
  275. };
  276. typedef struct CMCMYColor                CMCMYColor;
  277.  
  278. struct CMHLSColor {
  279.     unsigned short                     hue;                        /* 0..65535. Fraction of circle. Red at 0 */
  280.     unsigned short                     lightness;                    /* 0..65535 */
  281.     unsigned short                     saturation;                    /* 0..65535 */
  282. };
  283. typedef struct CMHLSColor                CMHLSColor;
  284.  
  285. struct CMHSVColor {
  286.     unsigned short                     hue;                        /* 0..65535. Fraction of circle. Red at 0 */
  287.     unsigned short                     saturation;                    /* 0..65535 */
  288.     unsigned short                     value;                        /* 0..65535 */
  289. };
  290. typedef struct CMHSVColor                CMHSVColor;
  291.  
  292. struct CMLabColor {
  293.     unsigned short                     L;                            /* 0..65535 maps to 0..100 */
  294.     unsigned short                     a;                            /* 0..65535 maps to -128..127.996 */
  295.     unsigned short                     b;                            /* 0..65535 maps to -128..127.996 */
  296. };
  297. typedef struct CMLabColor                CMLabColor;
  298.  
  299. struct CMLuvColor {
  300.     unsigned short                     L;                            /* 0..65535 maps to 0..100 */
  301.     unsigned short                     u;                            /* 0..65535 maps to -128..127.996 */
  302.     unsigned short                     v;                            /* 0..65535 maps to -128..127.996 */
  303. };
  304. typedef struct CMLuvColor                CMLuvColor;
  305.  
  306. struct CMYxyColor {
  307.     unsigned short                     capY;                        /* 0..65535 maps to 0..1 */
  308.     unsigned short                     x;                            /* 0..65535 maps to 0..1 */
  309.     unsigned short                     y;                            /* 0..65535 maps to 0..1 */
  310. };
  311. typedef struct CMYxyColor                CMYxyColor;
  312.  
  313. struct CMGrayColor {
  314.     unsigned short                     gray;                        /* 0..65535 */
  315. };
  316. typedef struct CMGrayColor                CMGrayColor;
  317.  
  318. struct CMMultichannel5Color {
  319.     unsigned char                     components[5];                /* 0..255 */
  320. };
  321. typedef struct CMMultichannel5Color        CMMultichannel5Color;
  322.  
  323. struct CMMultichannel6Color {
  324.     unsigned char                     components[6];                /* 0..255 */
  325. };
  326. typedef struct CMMultichannel6Color        CMMultichannel6Color;
  327.  
  328. struct CMMultichannel7Color {
  329.     unsigned char                     components[7];                /* 0..255 */
  330. };
  331. typedef struct CMMultichannel7Color        CMMultichannel7Color;
  332.  
  333. struct CMMultichannel8Color {
  334.     unsigned char                     components[8];                /* 0..255 */
  335. };
  336. typedef struct CMMultichannel8Color        CMMultichannel8Color;
  337.  
  338. struct CMNamedColor {
  339.     unsigned long                     namedColorIndex;            /* 0..a lot */
  340. };
  341. typedef struct CMNamedColor                CMNamedColor;
  342.  
  343. union CMColor {
  344.     CMRGBColor                         rgb;
  345.     CMHSVColor                         hsv;
  346.     CMHLSColor                         hls;
  347.     CMXYZColor                         XYZ;
  348.     CMLabColor                         Lab;
  349.     CMLuvColor                         Luv;
  350.     CMYxyColor                         Yxy;
  351.     CMCMYKColor                     cmyk;
  352.     CMCMYColor                         cmy;
  353.     CMGrayColor                     gray;
  354.     CMMultichannel5Color             mc5;
  355.     CMMultichannel6Color             mc6;
  356.     CMMultichannel7Color             mc7;
  357.     CMMultichannel8Color             mc8;
  358.     CMNamedColor                     namedColor;
  359. };
  360. typedef union CMColor                    CMColor;
  361.  
  362. struct CMProfileSearchRecord {
  363.     CMHeader                         header;
  364.     unsigned long                     fieldMask;
  365.     unsigned long                     reserved[2];
  366. };
  367. typedef struct CMProfileSearchRecord    CMProfileSearchRecord;
  368. typedef CMProfileSearchRecord *            CMProfileSearchRecordPtr;
  369. typedef CMProfileSearchRecordPtr *        CMProfileSearchRecordHandle;
  370. /* Search definition for 2.0 */
  371.  
  372. struct CMSearchRecord {
  373.     OSType                             CMMType;
  374.     OSType                             profileClass;
  375.     OSType                             dataColorSpace;
  376.     OSType                             profileConnectionSpace;
  377.     unsigned long                     deviceManufacturer;
  378.     unsigned long                     deviceModel;
  379.     unsigned long                     deviceAttributes[2];
  380.     unsigned long                     profileFlags;
  381.     unsigned long                     searchMask;
  382.     CMProfileFilterUPP                 filter;
  383. };
  384. typedef struct CMSearchRecord            CMSearchRecord;
  385. /* GetCWInfo structures */
  386.  
  387. struct CMMInfoRecord {
  388.     OSType                             CMMType;
  389.     long                             CMMVersion;
  390. };
  391. typedef struct CMMInfoRecord            CMMInfoRecord;
  392.  
  393. struct CMCWInfoRecord {
  394.     unsigned long                     cmmCount;
  395.     CMMInfoRecord                     cmmInfo[2];
  396. };
  397. typedef struct CMCWInfoRecord            CMCWInfoRecord;
  398. /* profile identifier structures */
  399.  
  400. struct CMProfileIdentifier {
  401.     CM2Header                         profileHeader;
  402.     CMDateTime                         calibrationDate;
  403.     unsigned long                     ASCIIProfileDescriptionLen;
  404.     char                             ASCIIProfileDescription[1];    /* variable length */
  405. };
  406. typedef struct CMProfileIdentifier        CMProfileIdentifier;
  407. typedef CMProfileIdentifier *            CMProfileIdentifierPtr;
  408. /* packing formats */
  409.  
  410. enum {
  411.     cmNoColorPacking            = 0x0000,
  412.     cmAlphaSpace                = 0x0080,
  413.     cmWord5ColorPacking            = 0x0500,
  414.     cmLong8ColorPacking            = 0x0800,
  415.     cmLong10ColorPacking        = 0x0A00,
  416.     cmAlphaFirstPacking            = 0x1000,
  417.     cmOneBitDirectPacking        = 0x0B00,
  418.     cmAlphaLastPacking            = 0x0000,
  419.     cm24_8ColorPacking            = 0x2100,
  420.     cm32_8ColorPacking            = cmLong8ColorPacking,
  421.     cm40_8ColorPacking            = 0x2200,
  422.     cm48_8ColorPacking            = 0x2300,
  423.     cm56_8ColorPacking            = 0x2400,
  424.     cm64_8ColorPacking            = 0x2500,
  425.     cm32_16ColorPacking            = 0x2600,
  426.     cm48_16ColorPacking            = 0x2900,
  427.     cm64_16ColorPacking            = 0x2A00,
  428.     cm32_32ColorPacking            = 0x2700
  429. };
  430.  
  431. /* general colorspaces */
  432.  
  433. enum {
  434.     cmNoSpace                    = 0,
  435.     cmRGBSpace                    = 1,
  436.     cmCMYKSpace                    = 2,
  437.     cmHSVSpace                    = 3,
  438.     cmHLSSpace                    = 4,
  439.     cmYXYSpace                    = 5,
  440.     cmXYZSpace                    = 6,
  441.     cmLUVSpace                    = 7,
  442.     cmLABSpace                    = 8,
  443.     cmReservedSpace1            = 9,
  444.     cmGraySpace                    = 10,
  445.     cmReservedSpace2            = 11,
  446.     cmGamutResultSpace            = 12,
  447.     cmNamedIndexedSpace            = 16,
  448.     cmMCFiveSpace                = 17,
  449.     cmMCSixSpace                = 18,
  450.     cmMCSevenSpace                = 19,
  451.     cmMCEightSpace                = 20,
  452.     cmRGBASpace                    = cmRGBSpace + cmAlphaSpace,
  453.     cmGrayASpace                = cmGraySpace + cmAlphaSpace
  454. };
  455.  
  456. /* supported CMBitmapColorSpaces - each of the following is a */
  457. /* combination of a general colospace and a packing formats */
  458.  
  459. enum {
  460.     cmGray16Space                = cmGraySpace,
  461.     cmGrayA32Space                = cmGrayASpace,
  462.     cmRGB16Space                = cmWord5ColorPacking + cmRGBSpace,
  463.     cmRGB24Space                = cm24_8ColorPacking + cmRGBSpace,
  464.     cmRGB32Space                = cm32_8ColorPacking + cmRGBSpace,
  465.     cmRGB48Space                = cm48_16ColorPacking + cmRGBSpace,
  466.     cmARGB32Space                = cm32_8ColorPacking + cmAlphaFirstPacking + cmRGBASpace,
  467.     cmRGBA32Space                = cm32_8ColorPacking + cmAlphaLastPacking + cmRGBASpace,
  468.     cmCMYK32Space                = cm32_8ColorPacking + cmCMYKSpace,
  469.     cmCMYK64Space                = cm64_16ColorPacking + cmCMYKSpace,
  470.     cmHSV32Space                = cmLong10ColorPacking + cmHSVSpace,
  471.     cmHLS32Space                = cmLong10ColorPacking + cmHLSSpace,
  472.     cmYXY32Space                = cmLong10ColorPacking + cmYXYSpace,
  473.     cmXYZ32Space                = cmLong10ColorPacking + cmXYZSpace,
  474.     cmLUV32Space                = cmLong10ColorPacking + cmLUVSpace,
  475.     cmLAB24Space                = cm24_8ColorPacking + cmLABSpace,
  476.     cmLAB32Space                = cmLong10ColorPacking + cmLABSpace,
  477.     cmLAB48Space                = cm48_16ColorPacking + cmLABSpace,
  478.     cmGamutResult1Space            = cmOneBitDirectPacking + cmGamutResultSpace,
  479.     cmNamedIndexed32Space        = cm32_32ColorPacking + cmNamedIndexedSpace,
  480.     cmMCFive8Space                = cm40_8ColorPacking + cmMCFiveSpace,
  481.     cmMCSix8Space                = cm48_8ColorPacking + cmMCSixSpace,
  482.     cmMCSeven8Space                = cm56_8ColorPacking + cmMCSevenSpace,
  483.     cmMCEight8Space                = cm64_8ColorPacking + cmMCEightSpace
  484. };
  485.  
  486.  
  487.  
  488. typedef unsigned long                     CMBitmapColorSpace;
  489.  
  490. struct CMBitmap {
  491.     char *                            image;
  492.     long                             width;
  493.     long                             height;
  494.     long                             rowBytes;
  495.     long                             pixelSize;
  496.     CMBitmapColorSpace                 space;
  497.     long                             user1;
  498.     long                             user2;
  499. };
  500. typedef struct CMBitmap                    CMBitmap;
  501.  
  502. /* Classic Print Manager Stuff */
  503.  
  504. enum {
  505.     enableColorMatchingOp        = 12,
  506.     registerProfileOp            = 13
  507. };
  508.  
  509.  
  510. enum {
  511.     cmNoProfileBase                = 0,
  512.     cmFileBasedProfile            = 1,
  513.     cmHandleBasedProfile        = 2,
  514.     cmPtrBasedProfile            = 3,
  515.     cmProcedureBasedProfile        = 4
  516. };
  517.  
  518.  
  519. struct CMFileLocation {
  520.     FSSpec                             spec;
  521. };
  522. typedef struct CMFileLocation            CMFileLocation;
  523.  
  524. struct CMHandleLocation {
  525.     Handle                             h;
  526. };
  527. typedef struct CMHandleLocation            CMHandleLocation;
  528.  
  529. struct CMPtrLocation {
  530.     Ptr                             p;
  531. };
  532. typedef struct CMPtrLocation            CMPtrLocation;
  533.  
  534. struct CMProcedureLocation {
  535.     CMProfileAccessUPP                 proc;
  536.     void *                            refCon;
  537. };
  538. typedef struct CMProcedureLocation        CMProcedureLocation;
  539.  
  540.  
  541. union CMProfLoc {
  542.     CMFileLocation                     fileLoc;
  543.     CMHandleLocation                 handleLoc;
  544.     CMPtrLocation                     ptrLoc;
  545.     CMProcedureLocation             procLoc;
  546. };
  547. typedef union CMProfLoc                    CMProfLoc;
  548.  
  549. struct CMProfileLocation {
  550.     short                             locType;
  551.     CMProfLoc                         u;
  552. };
  553. typedef struct CMProfileLocation        CMProfileLocation;
  554.  
  555. enum {
  556.     cmOriginalProfileLocationSize = 72,
  557.     cmCurrentProfileLocationSize = 72
  558. };
  559.  
  560.  
  561. /* Struct and enums used for Profile iteration */
  562.  
  563. enum {
  564.     cmProfileIterateDataVersion1 = 0x00010000
  565. };
  566.  
  567.  
  568. struct CMProfileIterateData {
  569.     unsigned long                     dataVersion;                /* cmProfileIterateDataVersion1 */
  570.     CM2Header                         header;
  571.     ScriptCode                         code;
  572.     Str255                             name;
  573.     CMProfileLocation                 location;
  574. };
  575. typedef struct CMProfileIterateData        CMProfileIterateData;
  576. /* Caller-supplied callback function for Profile iteration */
  577. typedef CALLBACK_API( OSErr , CMProfileIterateProcPtr )(CMProfileIterateData *iterateData, void *refCon);
  578. typedef STACK_UPP_TYPE(CMProfileIterateProcPtr)                 CMProfileIterateUPP;
  579. enum { uppCMProfileIterateProcInfo = 0x000003E0 };                 /* pascal 2_bytes Func(4_bytes, 4_bytes) */
  580. #define NewCMProfileIterateProc(userRoutine)                     (CMProfileIterateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMProfileIterateProcInfo, GetCurrentArchitecture())
  581. #define CallCMProfileIterateProc(userRoutine, iterateData, refCon)  CALL_TWO_PARAMETER_UPP((userRoutine), uppCMProfileIterateProcInfo, (iterateData), (refCon))
  582. /* Profile file and element access */
  583. EXTERN_API( CMError )
  584. CMNewProfile                    (CMProfileRef *            prof,
  585.                                  const CMProfileLocation * theProfile)                        FOURWORDINLINE(0x203C, 0x0008, 0x001B, 0xABEE);
  586.  
  587. EXTERN_API( CMError )
  588. CMOpenProfile                    (CMProfileRef *            prof,
  589.                                  const CMProfileLocation * theProfile)                        FOURWORDINLINE(0x203C, 0x0008, 0x001C, 0xABEE);
  590.  
  591. EXTERN_API( CMError )
  592. CMCloseProfile                    (CMProfileRef             prof)                                FOURWORDINLINE(0x203C, 0x0004, 0x001D, 0xABEE);
  593.  
  594. EXTERN_API( CMError )
  595. CMUpdateProfile                    (CMProfileRef             prof)                                FOURWORDINLINE(0x203C, 0x0004, 0x0034, 0xABEE);
  596.  
  597. EXTERN_API( CMError )
  598. CMCopyProfile                    (CMProfileRef *            targetProf,
  599.                                  const CMProfileLocation * targetLocation,
  600.                                  CMProfileRef             srcProf)                            FOURWORDINLINE(0x203C, 0x000C, 0x0025, 0xABEE);
  601.  
  602. EXTERN_API( CMError )
  603. CMValidateProfile                (CMProfileRef             prof,
  604.                                  Boolean *                valid,
  605.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x000C, 0x0026, 0xABEE);
  606.  
  607. EXTERN_API( CMError )
  608. CMGetProfileLocation            (CMProfileRef             prof,
  609.                                  CMProfileLocation *    theProfile)                            FOURWORDINLINE(0x203C, 0x0008, 0x003C, 0xABEE);
  610.  
  611. EXTERN_API( CMError )
  612. NCMGetProfileLocation            (CMProfileRef             prof,
  613.                                  CMProfileLocation *    theProfile,
  614.                                  unsigned long *        locationSize)                        FOURWORDINLINE(0x203C, 0x000C, 0x0059, 0xABEE);
  615.  
  616. EXTERN_API( CMError )
  617. CMFlattenProfile                (CMProfileRef             prof,
  618.                                  unsigned long             flags,
  619.                                  CMFlattenUPP             proc,
  620.                                  void *                    refCon,
  621.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0014, 0x0031, 0xABEE);
  622.  
  623. EXTERN_API( CMError )
  624. CMUnflattenProfile                (FSSpec *                resultFileSpec,
  625.                                  CMFlattenUPP             proc,
  626.                                  void *                    refCon,
  627.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0010, 0x0032, 0xABEE);
  628.  
  629. EXTERN_API( CMError )
  630. CMGetProfileHeader                (CMProfileRef             prof,
  631.                                  CMAppleProfileHeader *    header)                                FOURWORDINLINE(0x203C, 0x0008, 0x0039, 0xABEE);
  632.  
  633. EXTERN_API( CMError )
  634. CMSetProfileHeader                (CMProfileRef             prof,
  635.                                  const CMAppleProfileHeader * header)                        FOURWORDINLINE(0x203C, 0x0008, 0x003A, 0xABEE);
  636.  
  637. EXTERN_API( CMError )
  638. CMProfileElementExists            (CMProfileRef             prof,
  639.                                  OSType                 tag,
  640.                                  Boolean *                found)                                FOURWORDINLINE(0x203C, 0x000C, 0x001E, 0xABEE);
  641.  
  642. EXTERN_API( CMError )
  643. CMCountProfileElements            (CMProfileRef             prof,
  644.                                  unsigned long *        elementCount)                        FOURWORDINLINE(0x203C, 0x0008, 0x001F, 0xABEE);
  645.  
  646. EXTERN_API( CMError )
  647. CMGetProfileElement                (CMProfileRef             prof,
  648.                                  OSType                 tag,
  649.                                  unsigned long *        elementSize,
  650.                                  void *                    elementData)                        FOURWORDINLINE(0x203C, 0x0010, 0x0020, 0xABEE);
  651.  
  652. EXTERN_API( CMError )
  653. CMSetProfileElement                (CMProfileRef             prof,
  654.                                  OSType                 tag,
  655.                                  unsigned long             elementSize,
  656.                                  void *                    elementData)                        FOURWORDINLINE(0x203C, 0x0010, 0x0023, 0xABEE);
  657.  
  658. EXTERN_API( CMError )
  659. CMSetProfileElementSize            (CMProfileRef             prof,
  660.                                  OSType                 tag,
  661.                                  unsigned long             elementSize)                        FOURWORDINLINE(0x203C, 0x000C, 0x0038, 0xABEE);
  662.  
  663. EXTERN_API( CMError )
  664. CMSetProfileElementReference    (CMProfileRef             prof,
  665.                                  OSType                 elementTag,
  666.                                  OSType                 referenceTag)                        FOURWORDINLINE(0x203C, 0x000C, 0x0035, 0xABEE);
  667.  
  668. EXTERN_API( CMError )
  669. CMGetPartialProfileElement        (CMProfileRef             prof,
  670.                                  OSType                 tag,
  671.                                  unsigned long             offset,
  672.                                  unsigned long *        byteCount,
  673.                                  void *                    elementData)                        FOURWORDINLINE(0x203C, 0x0014, 0x0036, 0xABEE);
  674.  
  675. EXTERN_API( CMError )
  676. CMSetPartialProfileElement        (CMProfileRef             prof,
  677.                                  OSType                 tag,
  678.                                  unsigned long             offset,
  679.                                  unsigned long             byteCount,
  680.                                  void *                    elementData)                        FOURWORDINLINE(0x203C, 0x0014, 0x0037, 0xABEE);
  681.  
  682. EXTERN_API( CMError )
  683. CMGetIndProfileElementInfo        (CMProfileRef             prof,
  684.                                  unsigned long             index,
  685.                                  OSType *                tag,
  686.                                  unsigned long *        elementSize,
  687.                                  Boolean *                refs)                                FOURWORDINLINE(0x203C, 0x0014, 0x0021, 0xABEE);
  688.  
  689. EXTERN_API( CMError )
  690. CMGetIndProfileElement            (CMProfileRef             prof,
  691.                                  unsigned long             index,
  692.                                  unsigned long *        elementSize,
  693.                                  void *                    elementData)                        FOURWORDINLINE(0x203C, 0x0010, 0x0022, 0xABEE);
  694.  
  695. EXTERN_API( CMError )
  696. CMRemoveProfileElement            (CMProfileRef             prof,
  697.                                  OSType                 tag)                                FOURWORDINLINE(0x203C, 0x0008, 0x0024, 0xABEE);
  698.  
  699. EXTERN_API( CMError )
  700. CMGetScriptProfileDescription    (CMProfileRef             prof,
  701.                                  Str255                 name,
  702.                                  ScriptCode *            code)                                FOURWORDINLINE(0x203C, 0x000C, 0x003E, 0xABEE);
  703.  
  704. EXTERN_API( CMError )
  705. CMCloneProfileRef                (CMProfileRef             prof)                                FOURWORDINLINE(0x203C, 0x0004, 0x0042, 0xABEE);
  706.  
  707. EXTERN_API( CMError )
  708. CMGetProfileRefCount            (CMProfileRef             prof,
  709.                                  long *                    count)                                FOURWORDINLINE(0x203C, 0x0008, 0x0043, 0xABEE);
  710.  
  711. EXTERN_API( CMError )
  712. CMProfileModified                (CMProfileRef             prof,
  713.                                  Boolean *                modified)                            FOURWORDINLINE(0x203C, 0x0008, 0x0044, 0xABEE);
  714.  
  715.  
  716. /* named Color access functions */
  717. EXTERN_API( CMError )
  718. CMGetNamedColorInfo                (CMProfileRef             prof,
  719.                                  unsigned long *        deviceChannels,
  720.                                  OSType *                deviceColorSpace,
  721.                                  OSType *                PCSColorSpace,
  722.                                  unsigned long *        count,
  723.                                  StringPtr                 prefix,
  724.                                  StringPtr                 suffix)                                FOURWORDINLINE(0x203C, 0x001C, 0x0046, 0xABEE);
  725.  
  726. EXTERN_API( CMError )
  727. CMGetNamedColorValue            (CMProfileRef             prof,
  728.                                  StringPtr                 name,
  729.                                  CMColor *                deviceColor,
  730.                                  CMColor *                PCSColor)                            FOURWORDINLINE(0x203C, 0x0010, 0x0047, 0xABEE);
  731.  
  732. EXTERN_API( CMError )
  733. CMGetIndNamedColorValue            (CMProfileRef             prof,
  734.                                  unsigned long             index,
  735.                                  CMColor *                deviceColor,
  736.                                  CMColor *                PCSColor)                            FOURWORDINLINE(0x203C, 0x0010, 0x0048, 0xABEE);
  737.  
  738. EXTERN_API( CMError )
  739. CMGetNamedColorIndex            (CMProfileRef             prof,
  740.                                  StringPtr                 name,
  741.                                  unsigned long *        index)                                FOURWORDINLINE(0x203C, 0x000C, 0x0049, 0xABEE);
  742.  
  743. EXTERN_API( CMError )
  744. CMGetNamedColorName                (CMProfileRef             prof,
  745.                                  unsigned long             index,
  746.                                  StringPtr                 name)                                FOURWORDINLINE(0x203C, 0x000C, 0x004A, 0xABEE);
  747.  
  748.  
  749. /* Low-level matching functions */
  750. EXTERN_API( CMError )
  751. NCWNewColorWorld                (CMWorldRef *            cw,
  752.                                  CMProfileRef             src,
  753.                                  CMProfileRef             dst)                                FOURWORDINLINE(0x203C, 0x000C, 0x0014, 0xABEE);
  754.  
  755. EXTERN_API( CMError )
  756. CWConcatColorWorld                (CMWorldRef *            cw,
  757.                                  CMConcatProfileSet *    profileSet)                            FOURWORDINLINE(0x203C, 0x0008, 0x0015, 0xABEE);
  758.  
  759. EXTERN_API( CMError )
  760. CWNewLinkProfile                (CMProfileRef *            prof,
  761.                                  const CMProfileLocation * targetLocation,
  762.                                  CMConcatProfileSet *    profileSet)                            FOURWORDINLINE(0x203C, 0x000C, 0x0033, 0xABEE);
  763.  
  764. EXTERN_API( void )
  765. CWDisposeColorWorld                (CMWorldRef             cw)                                    FOURWORDINLINE(0x203C, 0x0004, 0x0001, 0xABEE);
  766.  
  767. EXTERN_API( CMError )
  768. CWMatchColors                    (CMWorldRef             cw,
  769.                                  CMColor *                myColors,
  770.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0002, 0xABEE);
  771.  
  772. EXTERN_API( CMError )
  773. CWCheckColors                    (CMWorldRef             cw,
  774.                                  CMColor *                myColors,
  775.                                  unsigned long             count,
  776.                                  long *                    result)                                FOURWORDINLINE(0x203C, 0x0010, 0x0003, 0xABEE);
  777.  
  778.  
  779. /* Bitmap matching */
  780. EXTERN_API( CMError )
  781. CWMatchBitmap                    (CMWorldRef             cw,
  782.                                  CMBitmap *                bitmap,
  783.                                  CMBitmapCallBackUPP     progressProc,
  784.                                  void *                    refCon,
  785.                                  CMBitmap *                matchedBitmap)                        FOURWORDINLINE(0x203C, 0x0010, 0x002C, 0xABEE);
  786.  
  787. EXTERN_API( CMError )
  788. CWCheckBitmap                    (CMWorldRef             cw,
  789.                                  const CMBitmap *        bitmap,
  790.                                  CMBitmapCallBackUPP     progressProc,
  791.                                  void *                    refCon,
  792.                                  CMBitmap *                resultBitmap)                        FOURWORDINLINE(0x203C, 0x0014, 0x002D, 0xABEE);
  793.  
  794.  
  795. /* Quickdraw-specific matching */
  796. EXTERN_API( CMError )
  797. CWMatchPixMap                    (CMWorldRef             cw,
  798.                                  PixMap *                myPixMap,
  799.                                  CMBitmapCallBackUPP     progressProc,
  800.                                  void *                    refCon)                                FOURWORDINLINE(0x203C, 0x0010, 0x0004, 0xABEE);
  801.  
  802. EXTERN_API( CMError )
  803. CWCheckPixMap                    (CMWorldRef             cw,
  804.                                  PixMap *                myPixMap,
  805.                                  CMBitmapCallBackUPP     progressProc,
  806.                                  void *                    refCon,
  807.                                  BitMap *                resultBitMap)                        FOURWORDINLINE(0x203C, 0x0014, 0x0007, 0xABEE);
  808.  
  809. EXTERN_API( CMError )
  810. NCMBeginMatching                (CMProfileRef             src,
  811.                                  CMProfileRef             dst,
  812.                                  CMMatchRef *            myRef)                                FOURWORDINLINE(0x203C, 0x000C, 0x0016, 0xABEE);
  813.  
  814. EXTERN_API( void )
  815. CMEndMatching                    (CMMatchRef             myRef)                                FOURWORDINLINE(0x203C, 0x0004, 0x000B, 0xABEE);
  816.  
  817. EXTERN_API( void )
  818. NCMDrawMatchedPicture            (PicHandle                 myPicture,
  819.                                  CMProfileRef             dst,
  820.                                  Rect *                    myRect)                                FOURWORDINLINE(0x203C, 0x000C, 0x0017, 0xABEE);
  821.  
  822. EXTERN_API( void )
  823. CMEnableMatchingComment            (Boolean                 enableIt)                            FOURWORDINLINE(0x203C, 0x0002, 0x000D, 0xABEE);
  824.  
  825. EXTERN_API( CMError )
  826. NCMUseProfileComment            (CMProfileRef             prof,
  827.                                  unsigned long             flags)                                FOURWORDINLINE(0x203C, 0x0008, 0x003B, 0xABEE);
  828.  
  829. EXTERN_API( CMError )
  830. CMCreateProfileIdentifier        (CMProfileRef             prof,
  831.                                  CMProfileIdentifierPtr  ident,
  832.                                  unsigned long *        size)                                FOURWORDINLINE(0x203C, 0x000C, 0x0041, 0xABEE);
  833.  
  834.  
  835. /* System Profile access */
  836. EXTERN_API( CMError )
  837. CMGetSystemProfile                (CMProfileRef *            prof)                                FOURWORDINLINE(0x203C, 0x0004, 0x0018, 0xABEE);
  838.  
  839. EXTERN_API( CMError )
  840. CMSetSystemProfile                (const FSSpec *            profileFileSpec)                    FOURWORDINLINE(0x203C, 0x0004, 0x0019, 0xABEE);
  841.  
  842. EXTERN_API( CMError )
  843. CMGetDefaultProfileBySpace        (OSType                 dataColorSpace,
  844.                                  CMProfileRef *            prof)                                FOURWORDINLINE(0x203C, 0x0008, 0x005A, 0xABEE);
  845.  
  846. EXTERN_API( CMError )
  847. CMSetDefaultProfileBySpace        (OSType                 dataColorSpace,
  848.                                  CMProfileRef             prof)                                FOURWORDINLINE(0x203C, 0x0008, 0x005B, 0xABEE);
  849.  
  850. EXTERN_API( CMError )
  851. CMGetProfileByAVID                (AVIDType                 theAVID,
  852.                                  CMProfileRef *            prof)                                FOURWORDINLINE(0x203C, 0x0008, 0x005C, 0xABEE);
  853.  
  854. EXTERN_API( CMError )
  855. CMSetProfileByAVID                (AVIDType                 theAVID,
  856.                                  CMProfileRef             prof)                                FOURWORDINLINE(0x203C, 0x0008, 0x005D, 0xABEE);
  857.  
  858.  
  859. /* External Profile Management */
  860. EXTERN_API( CMError )
  861. CMNewProfileSearch                (CMSearchRecord *        searchSpec,
  862.                                  void *                    refCon,
  863.                                  unsigned long *        count,
  864.                                  CMProfileSearchRef *    searchResult)                        FOURWORDINLINE(0x203C, 0x0010, 0x0027, 0xABEE);
  865.  
  866. EXTERN_API( CMError )
  867. CMUpdateProfileSearch            (CMProfileSearchRef     search,
  868.                                  void *                    refCon,
  869.                                  unsigned long *        count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0028, 0xABEE);
  870.  
  871. EXTERN_API( void )
  872. CMDisposeProfileSearch            (CMProfileSearchRef     search)                                FOURWORDINLINE(0x203C, 0x0004, 0x0029, 0xABEE);
  873.  
  874. EXTERN_API( CMError )
  875. CMSearchGetIndProfile            (CMProfileSearchRef     search,
  876.                                  unsigned long             index,
  877.                                  CMProfileRef *            prof)                                FOURWORDINLINE(0x203C, 0x000C, 0x002A, 0xABEE);
  878.  
  879. EXTERN_API( CMError )
  880. CMSearchGetIndProfileFileSpec    (CMProfileSearchRef     search,
  881.                                  unsigned long             index,
  882.                                  FSSpec *                profileFile)                        FOURWORDINLINE(0x203C, 0x000C, 0x002B, 0xABEE);
  883.  
  884. EXTERN_API( CMError )
  885. CMProfileIdentifierFolderSearch    (CMProfileIdentifierPtr  ident,
  886.                                  unsigned long *        matchedCount,
  887.                                  CMProfileSearchRef *    searchResult)                        FOURWORDINLINE(0x203C, 0x000C, 0x003F, 0xABEE);
  888.  
  889. EXTERN_API( CMError )
  890. CMProfileIdentifierListSearch    (CMProfileIdentifierPtr  ident,
  891.                                  CMProfileRef *            profileList,
  892.                                  unsigned long             listSize,
  893.                                  unsigned long *        matchedCount,
  894.                                  CMProfileRef *            matchedList)                        FOURWORDINLINE(0x203C, 0x0014, 0x0040, 0xABEE);
  895.  
  896. EXTERN_API( CMError )
  897. CMIterateColorSyncFolder        (CMProfileIterateUPP     proc,
  898.                                  unsigned long *        seed,
  899.                                  unsigned long *        count,
  900.                                  void *                    refCon)                                FOURWORDINLINE(0x203C, 0x0010, 0x0058, 0xABEE);
  901.  
  902.  
  903. /* Utilities */
  904. EXTERN_API( CMError )
  905. CMGetColorSyncFolderSpec        (short                     vRefNum,
  906.                                  Boolean                 createFolder,
  907.                                  short *                foundVRefNum,
  908.                                  long *                    foundDirID)                            FOURWORDINLINE(0x203C, 0x000C, 0x0011, 0xABEE);
  909.  
  910. EXTERN_API( CMError )
  911. CMGetCWInfo                        (CMWorldRef             cw,
  912.                                  CMCWInfoRecord *        info)                                FOURWORDINLINE(0x203C, 0x0008, 0x001A, 0xABEE);
  913.  
  914. EXTERN_API( CMError )
  915. CMConvertProfile2to1            (CMProfileRef             profv2,
  916.                                  CMProfileHandle *        profv1)                                FOURWORDINLINE(0x203C, 0x0008, 0x0045, 0xABEE);
  917.  
  918. EXTERN_API( CMError )
  919. CMGetPreferredCMM                (OSType *                cmmType,
  920.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0008, 0x005E, 0xABEE);
  921.  
  922.  
  923.  
  924. /* ColorSpace conversion functions */
  925. EXTERN_API( CMError )
  926. CMConvertXYZToLab                (const CMColor *        src,
  927.                                  const CMXYZColor *        white,
  928.                                  CMColor *                dst,
  929.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x0010, 0x004B, 0xABEE);
  930.  
  931. EXTERN_API( CMError )
  932. CMConvertLabToXYZ                (const CMColor *        src,
  933.                                  const CMXYZColor *        white,
  934.                                  CMColor *                dst,
  935.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x0010, 0x004C, 0xABEE);
  936.  
  937. EXTERN_API( CMError )
  938. CMConvertXYZToLuv                (const CMColor *        src,
  939.                                  const CMXYZColor *        white,
  940.                                  CMColor *                dst,
  941.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x0010, 0x004D, 0xABEE);
  942.  
  943. EXTERN_API( CMError )
  944. CMConvertLuvToXYZ                (const CMColor *        src,
  945.                                  const CMXYZColor *        white,
  946.                                  CMColor *                dst,
  947.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x0010, 0x004E, 0xABEE);
  948.  
  949. EXTERN_API( CMError )
  950. CMConvertXYZToYxy                (const CMColor *        src,
  951.                                  CMColor *                dst,
  952.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x004F, 0xABEE);
  953.  
  954. EXTERN_API( CMError )
  955. CMConvertYxyToXYZ                (const CMColor *        src,
  956.                                  CMColor *                dst,
  957.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0050, 0xABEE);
  958.  
  959. EXTERN_API( CMError )
  960. CMConvertRGBToHLS                (const CMColor *        src,
  961.                                  CMColor *                dst,
  962.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0051, 0xABEE);
  963.  
  964. EXTERN_API( CMError )
  965. CMConvertHLSToRGB                (const CMColor *        src,
  966.                                  CMColor *                dst,
  967.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0052, 0xABEE);
  968.  
  969. EXTERN_API( CMError )
  970. CMConvertRGBToHSV                (const CMColor *        src,
  971.                                  CMColor *                dst,
  972.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0053, 0xABEE);
  973.  
  974. EXTERN_API( CMError )
  975. CMConvertHSVToRGB                (const CMColor *        src,
  976.                                  CMColor *                dst,
  977.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0054, 0xABEE);
  978.  
  979. EXTERN_API( CMError )
  980. CMConvertRGBToGray                (const CMColor *        src,
  981.                                  CMColor *                dst,
  982.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0055, 0xABEE);
  983.  
  984. EXTERN_API( CMError )
  985. CMConvertXYZToFixedXYZ            (const CMXYZColor *        src,
  986.                                  CMFixedXYZColor *        dst,
  987.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0056, 0xABEE);
  988.  
  989. EXTERN_API( CMError )
  990. CMConvertFixedXYZToXYZ            (const CMFixedXYZColor * src,
  991.                                  CMXYZColor *            dst,
  992.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0057, 0xABEE);
  993.  
  994. /* PS-related */
  995. EXTERN_API( CMError )
  996. CMGetPS2ColorSpace                (CMProfileRef             srcProf,
  997.                                  unsigned long             flags,
  998.                                  CMFlattenUPP             proc,
  999.                                  void *                    refCon,
  1000.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0014, 0x002E, 0xABEE);
  1001.  
  1002. EXTERN_API( CMError )
  1003. CMGetPS2ColorRenderingIntent    (CMProfileRef             srcProf,
  1004.                                  unsigned long             flags,
  1005.                                  CMFlattenUPP             proc,
  1006.                                  void *                    refCon,
  1007.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0014, 0x002F, 0xABEE);
  1008.  
  1009. EXTERN_API( CMError )
  1010. CMGetPS2ColorRendering            (CMProfileRef             srcProf,
  1011.                                  CMProfileRef             dstProf,
  1012.                                  unsigned long             flags,
  1013.                                  CMFlattenUPP             proc,
  1014.                                  void *                    refCon,
  1015.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0018, 0x0030, 0xABEE);
  1016.  
  1017. EXTERN_API( CMError )
  1018. CMGetPS2ColorRenderingVMSize    (CMProfileRef             srcProf,
  1019.                                  CMProfileRef             dstProf,
  1020.                                  unsigned long *        vmSize,
  1021.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0010, 0x003D, 0xABEE);
  1022.  
  1023.  
  1024. /* ColorSync 1.0 functions which have parallel 2.0 counterparts */
  1025. EXTERN_API( CMError )
  1026. CWNewColorWorld                    (CMWorldRef *            cw,
  1027.                                  CMProfileHandle         src,
  1028.                                  CMProfileHandle         dst)                                FOURWORDINLINE(0x203C, 0x000C, 0x0000, 0xABEE);
  1029.  
  1030. EXTERN_API( CMError )
  1031. ConcatenateProfiles                (CMProfileHandle         thru,
  1032.                                  CMProfileHandle         dst,
  1033.                                  CMProfileHandle *        newDst)                                FOURWORDINLINE(0x203C, 0x000C, 0x000C, 0xABEE);
  1034.  
  1035. EXTERN_API( CMError )
  1036. CMBeginMatching                    (CMProfileHandle         src,
  1037.                                  CMProfileHandle         dst,
  1038.                                  CMMatchRef *            myRef)                                FOURWORDINLINE(0x203C, 0x000C, 0x000A, 0xABEE);
  1039.  
  1040. EXTERN_API( void )
  1041. CMDrawMatchedPicture            (PicHandle                 myPicture,
  1042.                                  CMProfileHandle         dst,
  1043.                                  Rect *                    myRect)                                FOURWORDINLINE(0x203C, 0x000C, 0x0009, 0xABEE);
  1044.  
  1045. EXTERN_API( CMError )
  1046. CMUseProfileComment                (CMProfileHandle         profile)                            FOURWORDINLINE(0x203C, 0x0004, 0x0008, 0xABEE);
  1047.  
  1048. EXTERN_API( void )
  1049. CMGetProfileName                (CMProfileHandle         myProfile,
  1050.                                  CMIString *            IStringResult)                        FOURWORDINLINE(0x203C, 0x0008, 0x000E, 0xABEE);
  1051.  
  1052. EXTERN_API( long )
  1053. CMGetProfileAdditionalDataOffset (CMProfileHandle         myProfile)                            FOURWORDINLINE(0x203C, 0x0004, 0x000F, 0xABEE);
  1054.  
  1055.  
  1056. /* ProfileResponder functions */
  1057. EXTERN_API( CMError )
  1058. GetProfile                        (OSType                 deviceType,
  1059.                                  long                     refNum,
  1060.                                  CMProfileHandle         aProfile,
  1061.                                  CMProfileHandle *        returnedProfile)                    FOURWORDINLINE(0x203C, 0x0010, 0x0005, 0xABEE);
  1062.  
  1063. EXTERN_API( CMError )
  1064. SetProfile                        (OSType                 deviceType,
  1065.                                  long                     refNum,
  1066.                                  CMProfileHandle         newProfile)                            FOURWORDINLINE(0x203C, 0x000C, 0x0006, 0xABEE);
  1067.  
  1068. EXTERN_API( CMError )
  1069. SetProfileDescription            (OSType                 deviceType,
  1070.                                  long                     refNum,
  1071.                                  long                     deviceData,
  1072.                                  CMProfileHandle         hProfile)                            FOURWORDINLINE(0x203C, 0x0010, 0x0010, 0xABEE);
  1073.  
  1074. EXTERN_API( CMError )
  1075. GetIndexedProfile                (OSType                 deviceType,
  1076.                                  long                     refNum,
  1077.                                  CMProfileSearchRecordHandle  search,
  1078.                                  CMProfileHandle *        returnProfile,
  1079.                                  long *                    index)                                FOURWORDINLINE(0x203C, 0x0014, 0x0012, 0xABEE);
  1080.  
  1081. EXTERN_API( CMError )
  1082. DeleteDeviceProfile                (OSType                 deviceType,
  1083.                                  long                     refNum,
  1084.                                  CMProfileHandle         deleteMe)                            FOURWORDINLINE(0x203C, 0x000C, 0x0013, 0xABEE);
  1085.  
  1086.  
  1087. #if OLDROUTINENAMES
  1088. /* constants */
  1089.  
  1090. typedef CMFlattenProcPtr                 CMFlattenProc;
  1091. typedef CMBitmapCallBackProcPtr         CMBitmapCallBackProc;
  1092. typedef CMProfileFilterProcPtr             CMProfileFilterProc;
  1093.  
  1094. enum {
  1095.     CMTrap                        = cmTrap,
  1096.     CMBeginProfile                = cmBeginProfile,
  1097.     CMEndProfile                = cmEndProfile,
  1098.     CMEnableMatching            = cmEnableMatching,
  1099.     CMDisableMatching            = cmDisableMatching
  1100. };
  1101.  
  1102. /* 1.0 Error codes, for compatibility with older applications. 1.0 CMM's may return obsolete error codes */
  1103.  
  1104. enum {
  1105.     CMNoError                    = 0,                            /*    obsolete name, use noErr */
  1106.     CMProfileError                = cmProfileError,
  1107.     CMMethodError                = cmMethodError,
  1108.     CMMemFullError                = -172,                            /*    obsolete, 2.0 uses memFullErr */
  1109.     CMUnimplementedError        = -173,                            /*    obsolete, 2.0 uses unimpErr */
  1110.     CMParamError                = -174,                            /*    obsolete, 2.0 uses paramErr */
  1111.     CMMethodNotFound            = cmMethodNotFound,
  1112.     CMProfileNotFound            = cmProfileNotFound,
  1113.     CMProfilesIdentical            = cmProfilesIdentical,
  1114.     CMCantConcatenateError        = cmCantConcatenateError,
  1115.     CMCantXYZ                    = cmCantXYZ,
  1116.     CMCantDeleteProfile            = cmCantDeleteProfile,
  1117.     CMUnsupportedDataType        = cmUnsupportedDataType,
  1118.     CMNoCurrentProfile            = cmNoCurrentProfile
  1119. };
  1120.  
  1121.  
  1122. enum {
  1123.     qdSystemDevice                = cmSystemDevice,
  1124.     qdGDevice                    = cmGDevice
  1125. };
  1126.  
  1127.  
  1128. enum {
  1129.     kMatchCMMType                = cmMatchCMMType,
  1130.     kMatchApplProfileVersion    = cmMatchApplProfileVersion,
  1131.     kMatchDataType                = cmMatchDataType,
  1132.     kMatchDeviceType            = cmMatchDeviceType,
  1133.     kMatchDeviceManufacturer    = cmMatchDeviceManufacturer,
  1134.     kMatchDeviceModel            = cmMatchDeviceModel,
  1135.     kMatchDeviceAttributes        = cmMatchDeviceAttributes,
  1136.     kMatchFlags                    = cmMatchFlags,
  1137.     kMatchOptions                = cmMatchOptions,
  1138.     kMatchWhite                    = cmMatchWhite,
  1139.     kMatchBlack                    = cmMatchBlack
  1140. };
  1141.  
  1142. /* types */
  1143. typedef CMCMYKColor                     CMYKColor;
  1144. typedef CMWorldRef                         CWorld;
  1145. typedef long *                            CMGamutResult;
  1146. /* functions */
  1147. #define EndMatching(myRef)                                                        CMEndMatching(myRef)
  1148. #define EnableMatching(enableIt)                                                CMEnableMatchingComment(enableIt)
  1149. #define GetColorSyncFolderSpec(vRefNum, createFolder, foundVRefNum, foundDirID)    CMGetColorSyncFolderSpec(vRefNum, createFolder, foundVRefNum, foundDirID)
  1150. #define BeginMatching(src, dst, myRef)                                            CMBeginMatching(src, dst, myRef)
  1151. #define DrawMatchedPicture(myPicture, dst, myRect)                                CMDrawMatchedPicture(myPicture, dst, myRect)
  1152. #define UseProfile(profile)                                                        CMUseProfileComment(profile)
  1153. #define GetProfileName(myProfile, IStringResult)                                CMGetProfileName(myProfile, IStringResult)
  1154. #define GetProfileAdditionalDataOffset(myProfile)                                CMGetProfileAdditionalDataOffset(myProfile)
  1155. #endif  /* OLDROUTINENAMES */
  1156.  
  1157.  
  1158. /* Deprecated stuff*/
  1159.  
  1160. /* PrGeneral parameter blocks */
  1161.  
  1162. struct TEnableColorMatchingBlk {
  1163.     short                             iOpCode;
  1164.     short                             iError;
  1165.     long                             lReserved;
  1166.     THPrint                         hPrint;
  1167.     Boolean                         fEnableIt;
  1168.     SInt8                             filler;
  1169. };
  1170. typedef struct TEnableColorMatchingBlk    TEnableColorMatchingBlk;
  1171.  
  1172. struct TRegisterProfileBlk {
  1173.     short                             iOpCode;
  1174.     short                             iError;
  1175.     long                             lReserved;
  1176.     THPrint                         hPrint;
  1177.     Boolean                         fRegisterIt;
  1178.     SInt8                             filler;
  1179. };
  1180. typedef struct TRegisterProfileBlk        TRegisterProfileBlk;
  1181.  
  1182. #if PRAGMA_STRUCT_ALIGN
  1183.     #pragma options align=reset
  1184. #elif PRAGMA_STRUCT_PACKPUSH
  1185.     #pragma pack(pop)
  1186. #elif PRAGMA_STRUCT_PACK
  1187.     #pragma pack()
  1188. #endif
  1189.  
  1190. #ifdef PRAGMA_IMPORT_OFF
  1191. #pragma import off
  1192. #elif PRAGMA_IMPORT
  1193. #pragma import reset
  1194. #endif
  1195.  
  1196. #ifdef __cplusplus
  1197. }
  1198. #endif
  1199.  
  1200. #endif /* __CMAPPLICATION__ */
  1201.  
  1202.